﻿using UnityEngine;
using System.Collections;

public class SphereRotate : MonoBehaviour {

	float rotateSpeed = 0f;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {

		//SpeedUp
		if (Input.GetKey(KeyCode.UpArrow))
		{
			rotateSpeed += 0.05f;
		}

		//SpeedDown
		if (Input.GetKey(KeyCode.DownArrow))
		{
			rotateSpeed -= 0.05f;
		}

		//TurnLeft
		if (Input.GetKey(KeyCode.LeftArrow))
		{
			gameObject.transform.Rotate(new Vector3 (0f,1f,0f),Space.World);
		}

		//TurnRight
		if (Input.GetKey(KeyCode.RightArrow))
		{
			gameObject.transform.Rotate(new Vector3 (0f,-1f,0f),Space.World);
		}
	


		if (Mathf.Abs(rotateSpeed)>3f){
			gameObject.transform.Rotate(Vector3.right*Time.deltaTime*rotateSpeed,Space.World);
		}
		else{
			gameObject.transform.Rotate(Vector3.right*Time.deltaTime*0,Space.World);
		}
	}
}
